<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<?php echo base_url();?>system/application/views/html/images/default/css/style.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo base_url();?>system/application/views/html/images/js/jslib.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>system/application/views/html/images/js/swf_noclick.js"></script>
<title>注册</title>
</head>
<body>
<div id="wrapper">
  <div class="header">
    <div class="header_left"></div>
    <div class="header_right">
      <li class="bg"><a href="<?php echo base_url();?>">首　页</a></li>
      <li><a href="<?php echo site_url();?>/display_index/news">行业资讯</a></li>
      <li><a href="<?php echo site_url()?>/list_product/list_goods">产品世界</a></li>
      <li><a href="#" target="_blank">数码论坛</a></li>
      <li><a href="<?php echo site_url()?>/user">会员中心</a></li>
      <li><a href="#">客户服务</a></li>
      <div class="clear"></div>
    </div>
    <div class="clear"></div>
  </div>
  <div class="banner"><img src="<?php echo base_url();?>system/application/views/html/images/default/img/banner.png" /></div><script type="text/javascript" src="<?php echo base_url();?>system/application/views/html/images/js/jquery.js"></script>
<script>
var canSubmit = {
username: 0,
password: 0,
r_password: 0,
mail: 0,
truename: 0,
yzm: 0};
function check(obj)
{
canSubmit[obj.name] = false;

if (!obj.value)
{
ajaxEnd({name: obj.name, message : '本项不能为空!'});
return;
}

if (obj.name == 'yzm')
getHtml('<?php echo base_url();?>system/application/views/html/index.php?q=member-register_check&action=check&do=' + obj.name + '&value=' + obj.value + '&captcha=' + document.reg.captcha.value);
else if (obj.name != 'password')
getHtml('<?php echo base_url();?>system/application/views/html/index.php?q=member-register_check&action=check&do=' + obj.name + '&value=' + obj.value);
else if (obj.value.length < 3 || obj.value.length > 16)
ajaxEnd({name: 'password', message : '密码长度不符合要求!'});
else
right('password');
}
function check_re(name)
{
var text = (name == 'password') ? '密码' : '邮箱地址';
canSubmit['r_' + name] = false;
if (document.reg[name].value != document.reg['r_' + name].value)
ajaxEnd({name: 'r_' + name, message : '您填写的' + text  + '与原始内容不同，请重新填写!'});
else if (canSubmit[name])
right('r_' + name);
}

var runSubmit = false;
function ajaxEnd(data)
{
if (data['message']==1) canSubmit[data['name']] = true;
$("#"+data['name'] + '_message').html(data['message']==1 ? '通过验证' : data['message']);
if (runSubmit)
{
if (canSubmit[data['name']])
checkSubmit();
else
{
runSubmit = false;
document.reg[data['name']].focus();
alert('您填写的内容中存在错误，请修正后再提交！');
$('#loading_icon').html('');
//document.getElementById('submit_button').disabled = false;
$("#submit_button").attr("disabled",false);
}
}
}
function right(name)
{
ajaxEnd({name: name, message : '1'});
}
function getHtml(url)
{
$.getJSON(url+"&",{}, function(json){
// format result
var result1 = json.name;
var result2 = json.message;
ajaxEnd({name: result1, message : result2});

})
}

function checkSubmit()
{
//document.getElementById('submit_button').disabled = false;
$("#submit_button").attr("disabled",false);
if (!runSubmit)
{
//document.getElementById('submit_button').disabled = true;
$("#submit_button").attr("disabled",true);
//document.getElementById('loading_icon').innerHTML = '&#160;<img src="images/default/img/loadings.gif" align="absmiddle" alt="Loading" />';
$('#loading_icon').html('&#160;<img src="images/default/img/loadings.gif" align="absmiddle" alt="Loading" />');
}
for(i in canSubmit)
{
if (!canSubmit[i])
{
runSubmit = true;
if (i == 'r_password')
check_re('password');
else check(document.reg[i]);
return false;
}
}
if (runSubmit)
{
runSubmit = false;
document.reg.submit();
}
else return true;
}

function recaptcha()
{
url = '<?php echo base_url();?>system/application/views/html/index.php?q=member-authpic&do=reload';
$.getJSON(url+"&",{}, function(json){
// format result
var result1 = json.src;
doRecaptcha({src: result1});

})

}

function doRecaptcha(data)
{
if (typeof data.src == 'undefined')
{
alert('获取验证码图片错误！请刷新页面重新填写！');
return;
}
//document.getElementById('captcha_image').src = data.src
$("#captcha_image").attr("src",data.src);
//$('#captcha_image').src = data.src;
document.reg.captcha.value = data.src;
$('#yzm_message').html();
document.reg.yzm.value = '';
document.reg.yzm.focus();
canSubmit['yzm'] = false;
}
</script>
  <div class="content">
  <div style="padding:30px;">
  <h6>会员注册</h6><hr>
  <form action="http://localhost/ptkdemo/index.php?q=member-register" name="reg" method="POST" onSubmit="return checkSubmit();" />
  <input type="hidden" name="from" value="http://localhost/ptkdemo/index.php" />
  <input type="hidden" name="formhash" value="c6aecdc0" />
  <input type="hidden" name="goto" value="doreg" />
  <div class="account">
    <ul>
      <li class="tit"> <span>*</span>帐户： </li>
      <li class="inp">
        <input name="username" type="text" onFocus="this.className = 'focus'" onblur=
              "this.className = 'blur'; check(this);" class="blur" value="" />
      </li>
      <li class="red" id="username_message" ></li>
    </ul>
    <p> 3～16位，由字母a～z(不区分大小写)、数字0～9、减号或下划线组成 </p>
    <ul>
      <li class="tit"> <span>*</span>密码： </li>
      <li class="inp">
        <input name="password" type="password" onFocus="this.className = 'focus'" onblur=
              "this.className = 'blur'; check(this);" class="blur" value="" />
      </li>
      <li class="red" id="password_message"> </li>
    </ul>
    <p> 3～16位，区分大小写 </p>
    <ul>
      <li class="tit"> <span>*</span>确认密码： </li>
      <li class="inp">
        <input name="r_password" type="password" onFocus="this.className = 'focus'" onblur=
              "this.className = 'blur'; check_re('password');" class="blur" value="" />
      </li>
      <li class="red" id="r_password_message" >  </li>
    </ul>
    <p> 请再次输入您的密码 </p>
    <ul>
      <li class="tit"> <span>*</span>真实姓名： </li>
      <li class="inp">
        <input name="truename" type="text" onFocus="this.className = 'focus'" onblur=
              "this.className = 'blur'; check(this);" class="blur" value="" />
      </li>
      <li class="red" id="truename_message" ></li>
    </ul>
<p> 请填写真实姓名，用于购物时联系用 </p>
    <ul>
      <li class="tit"> <span>*</span>EMAIL地址： </li>
      <li class="inp">
        <input name="mail" type="text" onFocus="this.className = 'focus'" onblur=
              "this.className = 'blur'; check(this);" class="blur" value="" />
      </li>
      <li class="red" id="mail_message" ></li>
    </ul>
    <p> 请填写真实的邮箱地址地址，用于忘记密码时取回 </p>
    <ul class="yz">
    

      <li class="red" id="yzm_message" > </li>
    </ul>
    <p></p>
    <p></p>
<br>
    
       </p>
  </div>
  <div  style="text-align:center">
    <input id="submit_button" type="submit" value="立即注册" />
    <span id="loading_icon"></span> </div>
  </form>
  
  
  </div>
  </div>
  <div class="footer">
    <p>关于我们 | 客户服务 | 联系我们 | 人才招聘 | 数码论坛</p>
    <p>广州市公安局天河分局备案编号：<span class="red">1101081463</span> &nbsp;&nbsp;&nbsp;粤ICP证<span class="red">070359号</span></p>
    <p>Copyright 2004-2008 中国数码网 版权所有</p>
    <div class="spacetwo">
      <table width="495" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="<?php echo base_url();?>system/application/views/html/images/default/img/footerone.png" /></td>
          <td><img src="<?php echo base_url();?>system/application/views/html/images/default/img/footertwo.png" /></td>
          <td><img src="<?php echo base_url();?>system/application/views/html/images/default/img/footerthree.png" /></td>
          <td><img src="<?php echo base_url();?>system/application/views/html/images/default/img/footerfour.png" /></td>
        </tr>
      </table>
    </div>
  </div>
</div>
</body>
</html> 
